void npc(Player @player, NPC @npc) {
int state = npc.getState();
int type = npc.getSelected();
if(state == 0){
npc.addText("Welcome to Cave of Life - Entrance! Would you like to go inside and fight #rHorntail#k? If you want to fight him, you may might need some #b#v2000005##k, so you can recover some HP if you have been hit by #rHorntail#k.\r\n#L0#I would like to buy 10 for 100,000 Mesos!#l\r\n#L1#No thanks, let me in now!#l");
npc.sendSimple();
}
else if(state == 1){
npc.setVariable("type", type);
if(type == 0){
if(player.getMesos() >= 100000){
player.giveMesos(-100000);
player.giveItem(2000005, 10);
npc.addText("Thank you for buying the potion. Use it as well!");
npc.sendOK();
} else {
npc.addText("Sorry, you don't have enough mesos to buy them!");
npc.sendOK();
}
npc.end();
}
else if(type == 1){
if(player.getLevel() >= 100){
player.changeMap(240050000);	
} else {
npc.addText("I'm sorry. You need to be at least level 100 or above to enter.");
npc.sendOK();
}
npc.end();
}
}
}